import { MongooseModule } from '@nestjs/mongoose';
import * as mongoose from 'mongoose';
import config from '../../config/db';
const mongoConfig = config.mongo

export default mongoose.connect(
  `mongodb://${mongoConfig.user}:${mongoConfig.password}@${mongoConfig.host}:${mongoConfig.port}/${mongoConfig.database}`,
  {
    poolSize: 5,
    keepAlive: true
  }
).then(() => {
  console.log('mongo数据库连接成功');
}, (err) => {
  console.log('err');
  throw err;
})